# coding=utf-8
import os
import log

proxyUser = "zrx501"
proxyPass = "17721"


def getProxy():
    # 代理服务器
    proxyHost = "222.184.35.97"
    proxyPort = "39559"
    # 代理隧道验证信息
    proxyMeta = "http://%(user)s:%(pass)s@%(host)s:%(port)s" % {
        "host": proxyHost,
        "port": proxyPort,
        "user": proxyUser,
        "pass": proxyPass,
    }
    log.info(""+proxyMeta)
    proxies = {
        "http": proxyMeta,
        "https": proxyMeta,
    }
    return proxies


def changeProxy():
    exe = "curl -u %(username)s:%(password)s http://ip.hahado.cn/switch-ip" % {"username": proxyUser,
                                                                               "password": proxyPass}
    os.system(exe)
